//在函数原型添加自己的call方法
Function.prototype.DJCall = function (thisArgs, ...args) {
  //   console.log(this);
  //   console.log(thisArgs);
  //   console.log(...args);
  let fn = this;
  //防止thisArgs传入非对象类型报错
  thisArgs = thisArgs ? Object(thisArgs) : window;
  let result = (thisArgs.fn = fn(...args));
  delete thisArgs.fn;
  return result;
};
function sum(num1, num2) {
  console.log('sum function...', num1, num2, this);
  return num1 + num2;
}
function foo() {
  console.log('foo function...');
}
foo.DJCall('AAA', 2, 'ww', 100);
let a = sum.DJCall('aaa', 100, 200);
console.log(a);
